﻿<%@ Page Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="PR_PositionSalary.aspx.cs" Inherits="KPIS.GERP.GHRMS.APP.App_UI.Forms.PR_PositionSalary" %>

<%@ Register src="../Controls/user.ascx" tagname="user" tagprefix="uc1" %>

<asp:Content ID="Content1" runat="server" contentplaceholderid="ContentPlaceHolder1">  
<script type="text/javascript">  

          function isNumberKeyDot(event)  // ตัวเลขทศนิยม
          {
             var charCode = (event.which) ? event.which : event.keyCode
             if(charCode > 31 && (charCode < 48 || charCode > 57) && charCode != 46){
             //    alert("กรอกได้แต่ตัวเลขทศนิยมครับ!")//
                 return false;
	          }
             return true;
          }
          function isNumberKey(event)  // ตัวเลขอย่างเดียว
          {
             var charCode = (event.which) ? event.which : event.keyCode
             if(charCode > 31 && (charCode < 48 || charCode > 57)){
//                 alert("กรอกได้แต่ตัวเลขครับ!")
                 return false;
	          }
             return true;
          }
           function onTextChange(sender) 
           {
                if (sender.get_value() == "") 
                {
                    sender.set_text("");
                }
          } 
            function openProjectDetails(idSD, idET)
            {
                 radopen("PR_SalaryDetail.aspx?idSD=" + idSD +"&idET="+ idET ,"ProjectDtls");
                 return false;
            }
            function closeRadWindow(sender, args)
             {
                 $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest();
            }
            function pagerefresh()
             {
                location.reload(true);
             }
</script>      
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
        
            <telerik:AjaxSetting AjaxControlID="RadGrid2">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid2" 
                        LoadingPanelID="RadAjaxLoadingPanel2" />
                </UpdatedControls>
            </telerik:AjaxSetting> 
            
            <telerik:AjaxSetting AjaxControlID="ddlStatusActive">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid2" 
                        LoadingPanelID="RadAjaxLoadingPanel2" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            
        </AjaxSettings>
    </telerik:RadAjaxManager>

       <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel2" runat="server">
    </telerik:RadAjaxLoadingPanel>   
    
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
    <Windows>
    <telerik:RadWindow 
        id="ProjectDtls" 
        runat="server"        
        showcontentduringload="false"
        VisibleStatusbar="false"
        width="760px"
        Height="450px"        
        Modal="true"
        OnClientClose="closeRadWindow">
    </telerik:RadWindow>
    </Windows>

        <Windows>
            <telerik:RadWindow 
                ID="RadWindow1"  
                DestroyOnClose = "true"               
                Modal ="true"                
                VisibleStatusbar ="false"
                runat="server">
            </telerik:RadWindow>
        </Windows>


</telerik:RadWindowManager>    
    
    <asp:panel ID="Panel6" runat="server" >
    <table width="1000" cellpadding="0" cellspacing="0">
        <tr valign="top">
        
            <td valign="top" align="left">
               <uc1:user ID="user1" runat="server" />
            </td>
             <td width="20" >
                 
            </td>
            
            <td>
            <div class="moduleDivSlim700">
                    <div class="moduleDivBottom700">
                         <asp:Panel ID="PanelFilter" runat="server" Width="700px" ScrollBars="Auto">
                            <table align = "center" width = "650px">
                                    <tr>
                                        <td align="right" >
                                            ประเภทบุคลากร :</td>
                                        <td align="left">
                                        <telerik:RadComboBox ID="ddlEmployeeType" runat="server" AllowCustomText="true" 
                                            AutoPostBack="true" CausesValidation="false" DataTextField="Name" 
                                            DataValueField="Sequence" EmptyMessage="... เลือกประเภทบุคลากร ..." 
                                            Filter="Contains" OnClientTextChange="onTextChange" 
                                            onselectedindexchanged="ddlEmployeeType_SelectedIndexChanged" Width="200px">
                                        </telerik:RadComboBox>
                                         <asp:RequiredFieldValidator ID="v7" runat="server" 
                                                ControlToValidate="ddlEmployeeType" ErrorMessage="*">
                                         </asp:RequiredFieldValidator>
                                        </td>                                        
                                       <td align="right">
                                       </td>
                                       <td align="left">
                                           &nbsp;</td>
                                    </tr>
                                </table>
                        </asp:Panel>
                    </div>
                </div>
            </td>
          </tr>
          <tr>
          <td colspan = "3">
        <div class="moduleDivSlim1000x450">
        <div class="moduleDivBottom1000">
        <table align="center" width ="980px" >
        <tr>
            <td align="left" class="tableHeader">
                อัตราเงินประจำตำแหน่ง
            </td>
        </tr>
        </table>
        <table width ="980px" align = "center" >
        <tr>
            <td >
                <asp:Panel ID="PanelGrid" runat="server" Height="350px" ScrollBars="Auto" Width="980px">
                    <telerik:RadGrid ID="RadGrid2" runat="server" 
                        AllowAutomaticDeletes="True" 
                        AllowFilteringByColumn="true" AllowMultiRowEdit="True" 
                        AllowMultiRowSelection="True" AllowPaging="True" AllowSorting="True" 
                        AutoGenerateColumns="False" EnableAJAX="True" EnableAJAXLoadingTemplate="True" 
                        GridLines="None" OnItemCommand="RadGrid2_ItemCommand" Skin="Outlook" 
                        Width="960px">
                        <MasterTableView 
                            AllowMultiColumnSorting="True"                             
                            CellSpacing="-1" 
                            ClientDataKeyNames="sal_grp_seq" CommandItemDisplay="Top" 
                            DataKeyNames="sal_grp_seq" InsertItemPageIndexAction="ShowItemOnCurrentPage" 
                            NoMasterRecordsText="&lt; ไม่มีข้อมูล &gt;">
                            <CommandItemTemplate>
                                <table width="100%">
                                    <tr>
                                        <td>
                                            <asp:LinkButton ID="cmdAddNew" runat="server" CausesValidation="False" 
                                                CommandName="InitInsert" 
                                                Visible="<%# !RadGrid2.MasterTableView.IsItemInserted && RadGrid2.EditIndexes.Count <= 0 %>">
                                            <img alt="" src="../Images/Buttons/AddRecord.gif" 
                                                style="border: 0px; vertical-align: middle;" /> เพิ่มอัตราเงินประจำตำแหน่ง</asp:LinkButton>
                                            &nbsp;&nbsp;
                                        </td>
                                        <td align="right">
                                        </td>
                                    </tr>
                                </table>
                            </CommandItemTemplate>
                            <RowIndicatorColumn>
                                <HeaderStyle Width="20px" />
                            </RowIndicatorColumn>
                            <ExpandCollapseColumn Visible="True">
                            </ExpandCollapseColumn>
                            <GroupByExpressions>
                                <telerik:GridGroupByExpression>
                                    <GroupByFields>
                                        <telerik:GridGroupByField FieldName="pos_type_name" 
                                            HeaderText="ตำแหน่งประเภท" />                                           
                                    </GroupByFields>
                                    <SelectFields>
                                        <telerik:GridGroupByField FieldName="pos_type_name" 
                                            HeaderText="ตำแหน่งประเภท"
                                            HeaderValueSeparator=" " />
                                    </SelectFields>
                                </telerik:GridGroupByExpression>
                            </GroupByExpressions>
                            <Columns>
                                <telerik:GridEditCommandColumn ButtonType="ImageButton" 
                                    EditText="คลิกเพื่อแก้ไขข้อมูล">
                                    <ItemStyle Width="15px" />
                                </telerik:GridEditCommandColumn>
                                <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" 
                                    ConfirmDialogType="RadWindow" ConfirmText="ลบข้อมูลที่เลือก?" 
                                    Text="คลิกเพื่อลบข้อมูล" UniqueName="column1">
                                    <HeaderStyle HorizontalAlign="Center" Width="10px" />
                                    <ItemStyle HorizontalAlign="Center" Width="10px" />
                                </telerik:GridButtonColumn>
                                <telerik:GridBoundColumn Visible = "false"
                                    AutoPostBackOnFilter="true" 
                                    CurrentFilterFunction="Contains" DataField="emp_type_name" 
                                    FilterControlWidth="100%" HeaderText="ประเภทบุคลากร" ShowFilterIcon="false" 
                                    UniqueName="emp_type_name">
                                </telerik:GridBoundColumn>
                                
                                <telerik:GridBoundColumn Visible = "false"
                                    AutoPostBackOnFilter="true" 
                                    CurrentFilterFunction="Contains" DataField="pos_type_name" 
                                    FilterControlWidth="100%" HeaderText="ตำแหน่งประเภท" ShowFilterIcon="false" 
                                    UniqueName="pos_type_name">
                                    <HeaderStyle HorizontalAlign="Center" Wrap="False" />
                                </telerik:GridBoundColumn>
                                <telerik:GridTemplateColumn 
                                    AutoPostBackOnFilter="true" 
                                    CurrentFilterFunction="Contains" DataField="class_name" 
                                    UniqueName = "class_name"
                                    FilterControlWidth="100%" HeaderStyle-HorizontalAlign="Center" 
                                    HeaderText="ระดับตำแหน่ง" ShowFilterIcon="false">
                                    <ItemTemplate>
                                        <asp:LinkButton ID="targetControl" runat="server" 
                                            OnClientClick='<%# string.Format("return openProjectDetails(\"{0}\",\"{1}\");", Eval("sal_grp_seq"),Eval("emp_type_seq")) %>' 
                                            Text='<%# Eval("class_name") %>'></asp:LinkButton>
                                    </ItemTemplate>
                                    <HeaderStyle HorizontalAlign="Center" />
                                </telerik:GridTemplateColumn>
                                <telerik:GridBoundColumn Visible = "false"
                                    DataFormatString = "{0:N2}"
                                    AutoPostBackOnFilter="true" 
                                    CurrentFilterFunction="Contains" 
                                    DataField="amount" 
                                    FilterControlWidth="100%" 
                                    HeaderText="อัตราเงิน<br>ประจำตำแหน่ง" 
                                    ShowFilterIcon="false" 
                                    ItemStyle-HorizontalAlign = "Center"
                                    UniqueName="amount">
                                </telerik:GridBoundColumn>                                
                                <telerik:GridBoundColumn AutoPostBackOnFilter="true" 
                                    CurrentFilterFunction="Contains" DataField="remarks" FilterControlWidth="100%" 
                                    HeaderText="หมายเหตุ" ShowFilterIcon="false" UniqueName="remarks">
                                </telerik:GridBoundColumn>
                            </Columns>
                            <EditFormSettings EditFormType="WebUserControl" 
                                UserControlName="../UserControls/PR_PositionSalary.ascx">
                                <EditColumn UniqueName="EditCommandColumn1">
                                </EditColumn>
                            </EditFormSettings>
                            <PagerStyle Mode="NextPrevNumericAndAdvanced" />
                        </MasterTableView>
                        <ClientSettings AllowColumnHide="True" AllowColumnsReorder="True" 
                            EnableRowHoverStyle="True" ReorderColumnsOnClient="True">
                            <Selecting AllowRowSelect="True" EnableDragToSelectRows="true" />
                        </ClientSettings>
                    </telerik:RadGrid>
      
                </asp:Panel>
            </td>
            </tr>
                </table>
                </div>
</div>
</td>
</tr>
</table>
</asp:panel>

</asp:Content>
